package com.jobpass.common.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jobpass.common.insterface.GradeMapper;
import com.jobpass.common.model.Grade;
import com.jobpass.common.service.GradeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author JobPass
 * @since 2020-07-17
 */
@Service
public class GradeServiceImpl extends ServiceImpl<GradeMapper, Grade> implements GradeService {
    @Resource
    private GradeMapper gradeMapper;
    @Override
    public List<Grade> FindAllGrade() {
        return gradeMapper.selectList(null);
    }

    @Override
    public Grade FindGradeById(Long id) {
        return gradeMapper.selectById(id);
    }

    @Override
    public int DeleteGradeById(Long id) {
        return gradeMapper.deleteById(id);
    }

    @Override
    public int UpdateGradeById(Grade grade) {
        return gradeMapper.updateById(grade);
    }

    @Override
    public int SavaGrade(Grade grade) {
        return gradeMapper.insert(grade);
    }

    @Override
    public Grade findGradeName(Long gradeId) {
        QueryWrapper<Grade> queryWrapper = new QueryWrapper();
        queryWrapper.eq("id", gradeId);
        return gradeMapper.selectOne(queryWrapper);
    }
}
